/*
 * File:   editListDialog.cpp
 * Author: switch
 *
 * Created on 18 février 2013, 11:00
 */

#include "editListDialog.h"

editListDialog::editListDialog(accueil *parent) :parent_(parent) {
    widget.setupUi(this);
        
    ListOfTask *list = parent_->getSelectedList();
    
    widget.listName->setText(QString(list->getName().c_str()));
    
    QDate date(list->getDate().getYear(),list->getDate().getMonth(),list->getDate().getDay());
    
    widget.newDate->setSelectedDate(date);
    
    QObject::connect(widget.editButton, SIGNAL(clicked()), this, SLOT(editListListener()));  
}

editListDialog::~editListDialog() {
}

        
void editListDialog::editListListener() {
    
    
    ListOfTask *list = parent_->getSelectedList();
 
    list->setDate(Date(widget.newDate->selectedDate().day(),widget.newDate->selectedDate().month(), widget.newDate->selectedDate().year() ));
    
    list->setName(widget.listName->text().toStdString());
    
    parent_->editCurrentList(widget.listName->text().toStdString());
    
    
}